import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/rb-merchant/merchant/invoice/invoiceList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (rptAisleOrderCode) => {
  return request({
    url: '/api/rb-merchant/merchant/invoice/invoiceInfo',
    method: 'get',
    params: {
      rptAisleOrderCode
    }
  })
}

export const save = (row) => {
  return request({
    url: '/api/rb-merchant/merchant/invoice/changeInvoice',
    method: 'post',
    data: row
  })
}

export const sendInvoice = (row) => {
  return request({
    url: '/api/rb-merchant/merchant/invoice/sendInvoice',
    method: 'post',
    data: row
  })
}

export const downloadInvoice = (rptOrderCode) => {
  return request({
    url: '/api/rb-merchant/merchant/invoice/downloadInvoice',
    method: 'get',
    params: {
      rptOrderCode
    }
  })
}

export const getExport = (params) => {
  return request({
    /*headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',*/
    url: '/api/rb-merchant/merchant/invoice/export',
    method: 'get',
    params: {
      ...params
    }
  })
}

/* 导出模板 */
export const getExportTemplate = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-merchant/merchant/active/activerecord/export-template',
    method: 'get',
    params: {
      ...params,
    }
  })
}

